package usualclass;

public class StringDemo {
    public static void main(String[] args) {

        /*String str =new String("Lance").intern();//对匿名对象"hello"进行手工入池操作
        String str1="Lance";
        System.out.println(str==str1);//true*/
        /*String s4 = "aa,bb,cc";
        String[] strArray = s4.split("");
        for (int x = 0; x < strArray.length; x++) {
            System.out.println(strArray[x]);
        }*/

        /*String s = new String("4444123").intern();
        s.intern();
        String s3 = "4444123";
        System.out.println(s==s2);
        System.out.println(s==s3);
        System.out.println(s2==s3);*/
//        String str2 = new String("str")+new String("01");
//        str2.intern();
//        String str1 = "str01";
//        System.out.println(str2==str1);

        String str2 = new String("str")+new String("01");
        str2.intern();
        String str1 = "str01";
        System.out.println(str2==str1);
        String h = new String("cc");
        String intern = h.intern();
        System.out.println(intern == "cc"); // 返回true
        System.out.println(intern == h); // 返回false
    }
}
